#ifndef YIGCLOCK_H
#define YIGCLOCK_H

#include <QWidget>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QToolButton>
#include <QTimer>
#include <QTime>

class YigClock : public QWidget
{
    Q_OBJECT

public:

    enum ClockState {
        START,
        STOP,
        RESET
    };

    YigClock(QWidget *parent = 0);
    ~YigClock();
    
signals:

    void clockStateChanged(ClockState state);
    
public slots:

    void start();
    void stop();
    void reset();
    void setClockState(ClockState state, bool updateNetwork = false);

private slots:

    void tick();
    void toggleStartButton(bool checked);

private:

    ClockState mState;

    QLineEdit mLCD;
    QHBoxLayout mHorizontalLayout;
    QVBoxLayout mVerticalLayout;
    QToolButton mStartButton, mResetButton;
    QTimer mClockTimer;
    QTime mTime;
    int mTimeSeconds, mTimeMinutes, mTimeHours; // Nothing fancy, we just want a rough idea of the time passed
};

#endif // YIGCLOCK_H
